<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 应用场景：在复杂类型（Array，Object）的赋值运算中

        // 浅拷贝:既传值也传址
        var arr = [1,2,3];
        var b = arr;
        b.push(4);
        console.log('b: ', b);
        console.log("arr: ", arr);


        // 深拷贝：只传值
        arr1 = [1,2,3];
        var c = [];
        arr1.forEach(res=>{
            c.push(res)
        })
        console.log('c: ', c);
        console.log('arr1: ', arr1);
    </script>
</body>
</html>